xentrace: Disable tracing, then read records one more time.
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 3 Feb 2010 09:36:37 +0000 (09:36 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 3 Feb 2010 09:36:37 +0000 (09:36 +0000)
When interrupted, first disable tracing, then read through the records
one last time.

Without this patch, it's possible to get traces which interact (such
as runstate changes) on processors with higher numbers, while missing
the corresponding traces generated on lower-numbered processors.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
tools/xentrace/xentrace.c

index 7f63e7fc9d1f02ad88f39a4d0d3ebabf4a14cd93..18283f3e9794f74fd937f9689c07f42a50841848 100644 (file)
@@ -634,6 +634,8 @@ static int monitor_tbufs(void)
 
     unsigned long data_size;
 
+    int last_read = 1;
+
     /* prepare to listen for VIRQ_TBUF */
     event_init();
 
@@ -712,14 +714,22 @@ static int monitor_tbufs(void)
         }
 
         if ( interrupted )
-            break;
+        {
+            if ( last_read )
+            {
+                /* Disable tracing, then read through all the buffers one last time */
+                if ( opts.disable_tracing )
+                    disable_tbufs();
+                last_read = 0;
+                continue;
+            }
+            else
+                break;
+        }
 
         wait_for_event_or_timeout(opts.poll_sleep);
     }
 
-    if ( opts.disable_tracing )
-        disable_tbufs();
-
     if ( opts.memory_buffer )
         membuf_dump();